package com.hlx.utils;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class Result<T> {
    //若为1成功
    private Integer code;
    private String msg;
    private T data;
    public static <T> Result<T> success(T object){
        Result<T> r = new Result<T>();
        r.data = object;
        r.code = 1;
        r.msg = "成功";
        return r;
    }

    public static <T> Result<T> error(String msg){
        Result<T> r = new Result<T>();
        r.msg = msg;
        r.code = 0;
        return r;
    }

}
